import api from '../../http/apis/apis.js';
export default {

    namespaced: 'true',
    state: {
        // 是否折叠
        isCollapse: true,

        // 二级导航数据
        asideDate: [
            {
                authName: '管理员管理',  //一级菜单
                iconName: 'el-icon-user-solid', //一级菜单图标
                children: [{
                    name: '新增管理员',   //二级菜单
                    path: 'AddAdmin',   //跳转地址 跳转成功需要和router同步 这个地址会显示在url地址栏
                    icon: 'el-icon-back',
                    isShow:true
                },
                { name: "管理员列表", path: "Adminstratorlist", icon: 'el-icon-back',isShow:true  },
                { name: "查看管理员个人信息", path: "MyAdmin", icon: 'el-icon-back',isShow:true  },
                ]
            },
            {
                authName: '销售员管理',
                iconName: 'el-icon-user-solid',
                children: [{
                    name: '新增销售',
                    path: 'AddSales',
                    icon: 'el-icon-back'
                },
                {
                    name: '销售列表',
                    path: 'SalesList',
                    icon: 'el-icon-back'
                },
                ]
            },

            {
                authName: '保险产品管理',
                iconName: 'el-icon-notebook-1',
                children: [{
                    name: '保险产品列表',
                    path: 'productlist',
                    icon: 'el-icon-arrow-left'
                },
                {
                    name: '新增产品列表',
                    path: 'addproduct',
                    icon: 'el-icon-arrow-left'
                },
                ]
            },
            {
                authName: '保险分类管理',
                iconName: 'el-icon-user-solid',
                children: [{
                    name: '保险分类列表',
                    path: 'insurancelist',
                    icon: 'el-icon-arrow-left'
                },
                {
                    name: '新增保险分类',
                    path: 'addinsurance',
                    icon: 'el-icon-arrow-left'
                },]
            },
            {
                authName: '理赔中心',
                iconName: 'el-icon-office-building',
                children: [{
                    name: '理赔申请',
                    path: 'lipie',
                    icon: 'el-icon-finished'
                }
                ]
            },
        ],
        // 销售员数据
        saleDate: [
            {
                authName: '保险订单管理',  //一级菜单
                iconName: 'el-icon-s-custom', //一级菜单图标
                children: [
                    {
                        name: '订单列表',   //二级菜单
                        path: 'Orderlist',   //跳转地址 跳转成功需要和router同步 这个地址会显示在url地址栏
                        icon: 'el-icon-bottom-left' //二级菜单图标
                    },
                    // {
                    //     name: '取消理赔',   //二级菜单
                    //     path: 'Cancellation',   //跳转地址 跳转成功需要和router同步 这个地址会显示在url地址栏
                    //     icon: 'el-icon-bottom-left' //二级菜单图标
                    // },
                ],
            },
            {
                authName: '客户管理',
                iconName: 'el-icon-user-solid',
                children: [
                    {
                        name: '客户列表',
                        path: 'Customerslist',
                        icon: 'el-icon-back'
                    },
                    {
                        name: '添加客户',
                        path: 'Addcustomers',
                        icon: 'el-icon-back'
                    },
                ]
            },
            {
                authName: '理赔管理',
                iconName: 'el-icon-notebook-1',
                children: [{
                    name: '理赔列表',
                    path: 'Lipeilist',
                    icon: 'el-icon-arrow-left'
                },
                // {
                //     name: '理赔修改',
                //     path: 'Change/:_id',
                //     icon: 'el-icon-arrow-left'
                // },
                // {
                //     name: '上传理赔凭证',
                //     path: 'Uploadimg',
                //     icon: 'el-icon-arrow-left'
                // },
                ]
            },
            {
                authName: '个人中心',
                iconName: 'el-icon-office-building',
                children: [
                    {
                        name: '修改密码',
                        path: 'Changepwd',
                        icon: 'el-icon-finished'
                    },
                    {
                        name: '修改个人信息',
                        path: 'Updatepersonal',
                        icon: 'el-icon-finished'
                    },
                ]
            },
        ],

    },
    mutations:{
       SuperAdminShow(state){
           state.asideDate[0].children[0].isShow=false;
           state.asideDate[0].children[1].isShow=false;
       },
       AdminShow(state){
        state.asideDate[0].children[2].isShow=false;
       }
    },
    actions:{
        async isLogin(context){
            const {data}=await api.admin.isLogin()
           
            if(data.data.permission=='9'){
               
                context.commit('SuperAdminShow')
            }else{
                context.commit('AdminShow')  
            }
            return data.data
        }
    }


}